﻿//==========================================================
// 此代码由TilverNET代码生成工具自动生成，请不要修改
// 代码生成器版本号：1.2
// 作者：landy
// 联系方式：(QQ)86566178
// 创建时间：2014-10-13 11:00:48
//==========================================================

using System;
using System.Text;
using System.Data;
using System.Data.Common;
using System.Collections.Generic;
using System.Linq;
using Tilver.Data;
using Tilver.Data.DataPager;

namespace Weather.DAL.CoWeather
{
	#region EO

	/// <summary>
	///  《dbo.T_Station_Area(实体类)》
	/// </summary>
	[Serializable]
	public class TStationAreaEO : IRowMapper<TStationAreaEO>
	{
		protected long _iD;
		protected string _coder省市;
		protected string _coder地市;
		protected string _coder县域;
		protected string _coder站名;
		protected string _coder站号;
		protected double? _coder东经;
		protected double? _coder北纬;
		protected double? _coder拔高;
		protected double? _coder百度东经;
		protected double? _coder百度北纬;


		/// <summary>
		///  《[字段]  [bigint]   自增字段》
		/// </summary>
		public long ID
		{
			get { return _iD; }
			set { _iD = value;}
		}

		/// <summary>
		///  《[字段]  [varchar]》
		/// </summary>
		public string Coder省市
		{
			get { return _coder省市; }
			set { _coder省市 = value;}
		}

		/// <summary>
		///  《[字段]  [varchar]》
		/// </summary>
		public string Coder地市
		{
			get { return _coder地市; }
			set { _coder地市 = value;}
		}

		/// <summary>
		///  《[字段]  [varchar]》
		/// </summary>
		public string Coder县域
		{
			get { return _coder县域; }
			set { _coder县域 = value;}
		}

		/// <summary>
		///  《[字段]  [varchar]》
		/// </summary>
		public string Coder站名
		{
			get { return _coder站名; }
			set { _coder站名 = value;}
		}

		/// <summary>
		///  《[字段]  [varchar]》
		/// </summary>
		public string Coder站号
		{
			get { return _coder站号; }
			set { _coder站号 = value;}
		}

		/// <summary>
		///  《[字段]  [float]》
		/// </summary>
		public double? Coder东经
		{
			get { return _coder东经; }
			set { _coder东经 = value;}
		}

		/// <summary>
		///  《[字段]  [float]》
		/// </summary>
		public double? Coder北纬
		{
			get { return _coder北纬; }
			set { _coder北纬 = value;}
		}

		/// <summary>
		///  《[字段]  [float]》
		/// </summary>
		public double? Coder拔高
		{
			get { return _coder拔高; }
			set { _coder拔高 = value;}
		}

		/// <summary>
		///  《[字段]  [float]》
		/// </summary>
		public double? Coder百度东经
		{
			get { return _coder百度东经; }
			set { _coder百度东经 = value;}
		}

		/// <summary>
		///  《[字段]  [float]》
		/// </summary>
		public double? Coder百度北纬
		{
			get { return _coder百度北纬; }
			set { _coder百度北纬 = value;}
		}

		/// <summary>
		/// 默认构造函数
		/// </summary>
		public TStationAreaEO() 
		{
			Coder省市 = string.Empty;
			Coder地市 = string.Empty;
			Coder县域 = string.Empty;
			Coder站名 = string.Empty;
			Coder站号 = string.Empty;
		}

		/// <summary>
		/// 自定义构造函数
		/// </summary>
		/// <param name = "iD"></param>
		/// <param name = "coder省市"></param>
		/// <param name = "coder地市"></param>
		/// <param name = "coder县域"></param>
		/// <param name = "coder站名"></param>
		/// <param name = "coder站号"></param>
		/// <param name = "coder东经"></param>
		/// <param name = "coder北纬"></param>
		/// <param name = "coder拔高"></param>
		/// <param name = "coder百度东经"></param>
		/// <param name = "coder百度北纬"></param>
		public TStationAreaEO(long iD, string coder省市, string coder地市, string coder县域, string coder站名, string coder站号, double? coder东经, double? coder北纬, double? coder拔高, double? coder百度东经, double? coder百度北纬) 
		{
			_iD = iD;
			_coder省市 = coder省市;
			_coder地市 = coder地市;
			_coder县域 = coder县域;
			_coder站名 = coder站名;
			_coder站号 = coder站号;
			_coder东经 = coder东经;
			_coder北纬 = coder北纬;
			_coder拔高 = coder拔高;
			_coder百度东经 = coder百度东经;
			_coder百度北纬 = coder百度北纬;
		}


		/// <summary>
		/// 将结果集映射成实体对象
		/// </summary>
		/// <param name = "reader">只进结果集流</param>
		/// <return></return>
		public TStationAreaEO MapRow(IDataReader reader)
		{
			var ret = new TStationAreaEO();
			ret.ID = (long)reader["ID"];
			ret.Coder省市 = (string)reader["省市"];
			ret.Coder地市 = (string)reader["地市"];
			ret.Coder县域 = (string)reader["县域"];
			ret.Coder站名 = (string)reader["站名"];
			ret.Coder站号 = (string)reader["站号"];
			ret.Coder东经 = (reader["东经"] is DBNull) ? null : (double?)reader["东经"];
			ret.Coder北纬 = (reader["北纬"] is DBNull) ? null : (double?)reader["北纬"];
			ret.Coder拔高 = (reader["拔高"] is DBNull) ? null : (double?)reader["拔高"];
			ret.Coder百度东经 = (reader["百度东经"] is DBNull) ? null : (double?)reader["百度东经"];
			ret.Coder百度北纬 = (reader["百度北纬"] is DBNull) ? null : (double?)reader["百度北纬"];
			return ret;
		}

		/// <summary>
		/// 将结果集映射成实体对象，返回映射方法
		/// </summary>
		/// <return></return>
		public Func<IDataReader, TStationAreaEO> GetMapper()
		{
			return MapRow;
		}


	}


	#endregion
	#region MO

	/// <summary>
	///  《dbo.T_Station_Area(逻辑类)》
	/// </summary>
	public class TStationAreaMO : DbManagerBase
	{

		#region 构造函数
		/// <summary>
		/// 构造函数
		/// </summary>
		/// <param name = "routeData">路由数据</param>
		public TStationAreaMO(object routeData = null) : base(routeData) { }

		/// <summary>
		/// 构造函数
		/// </summary>
		/// <param name = "connectionStringName">连接字符串名称</param>
		public TStationAreaMO(string connectionStringName) : base(connectionStringName) { }

		#endregion

		#region 私有方法
		/// <summary>
		/// 数据库访问操作方法
		/// </summary>
		/// <param name = "sql">SQL语句</param>
		/// <return>返回数据操作对象</return>
		private DbAdoBase AdoBase(string sql)
		{
			return DataBase.CreateDbAdo(sql, CommandType.Text);
		}

		#endregion

		#region Select方法集合

		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "iD"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<TStationAreaEO> SelectByID(long iD, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [ID], [省市], [地市], [县域], [站名], [站号], [东经], [北纬], [拔高], [百度东经], [百度北纬] FROM [dbo].[T_Station_Area] WHERE [ID]=@ID");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@ID", iD, DbType.Int64, 8)
							.ExecuteList(new TStationAreaEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "coder省市"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<TStationAreaEO> SelectByCoder省市(string coder省市, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [ID], [省市], [地市], [县域], [站名], [站号], [东经], [北纬], [拔高], [百度东经], [百度北纬] FROM [dbo].[T_Station_Area] WHERE [省市]=@Coder省市");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@Coder省市", coder省市, DbType.AnsiString, 50)
							.ExecuteList(new TStationAreaEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "coder地市"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<TStationAreaEO> SelectByCoder地市(string coder地市, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [ID], [省市], [地市], [县域], [站名], [站号], [东经], [北纬], [拔高], [百度东经], [百度北纬] FROM [dbo].[T_Station_Area] WHERE [地市]=@Coder地市");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@Coder地市", coder地市, DbType.AnsiString, 50)
							.ExecuteList(new TStationAreaEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "coder县域"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<TStationAreaEO> SelectByCoder县域(string coder县域, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [ID], [省市], [地市], [县域], [站名], [站号], [东经], [北纬], [拔高], [百度东经], [百度北纬] FROM [dbo].[T_Station_Area] WHERE [县域]=@Coder县域");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@Coder县域", coder县域, DbType.AnsiString, 50)
							.ExecuteList(new TStationAreaEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "coder站名"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<TStationAreaEO> SelectByCoder站名(string coder站名, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [ID], [省市], [地市], [县域], [站名], [站号], [东经], [北纬], [拔高], [百度东经], [百度北纬] FROM [dbo].[T_Station_Area] WHERE [站名]=@Coder站名");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@Coder站名", coder站名, DbType.AnsiString, 50)
							.ExecuteList(new TStationAreaEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "coder站号"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<TStationAreaEO> SelectByCoder站号(string coder站号, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [ID], [省市], [地市], [县域], [站名], [站号], [东经], [北纬], [拔高], [百度东经], [百度北纬] FROM [dbo].[T_Station_Area] WHERE [站号]=@Coder站号");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@Coder站号", coder站号, DbType.AnsiString, 50)
							.ExecuteList(new TStationAreaEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "coder东经"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<TStationAreaEO> SelectByCoder东经(double? coder东经, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [ID], [省市], [地市], [县域], [站名], [站号], [东经], [北纬], [拔高], [百度东经], [百度北纬] FROM [dbo].[T_Station_Area] WHERE [东经]=@Coder东经");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@Coder东经", coder东经, DbType.Double, 8)
							.ExecuteList(new TStationAreaEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "coder北纬"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<TStationAreaEO> SelectByCoder北纬(double? coder北纬, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [ID], [省市], [地市], [县域], [站名], [站号], [东经], [北纬], [拔高], [百度东经], [百度北纬] FROM [dbo].[T_Station_Area] WHERE [北纬]=@Coder北纬");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@Coder北纬", coder北纬, DbType.Double, 8)
							.ExecuteList(new TStationAreaEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "coder拔高"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<TStationAreaEO> SelectByCoder拔高(double? coder拔高, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [ID], [省市], [地市], [县域], [站名], [站号], [东经], [北纬], [拔高], [百度东经], [百度北纬] FROM [dbo].[T_Station_Area] WHERE [拔高]=@Coder拔高");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@Coder拔高", coder拔高, DbType.Double, 8)
							.ExecuteList(new TStationAreaEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "coder百度东经"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<TStationAreaEO> SelectByCoder百度东经(double? coder百度东经, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [ID], [省市], [地市], [县域], [站名], [站号], [东经], [北纬], [拔高], [百度东经], [百度北纬] FROM [dbo].[T_Station_Area] WHERE [百度东经]=@Coder百度东经");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@Coder百度东经", coder百度东经, DbType.Double, 8)
							.ExecuteList(new TStationAreaEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "coder百度北纬"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<TStationAreaEO> SelectByCoder百度北纬(double? coder百度北纬, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [ID], [省市], [地市], [县域], [站名], [站号], [东经], [北纬], [拔高], [百度东经], [百度北纬] FROM [dbo].[T_Station_Area] WHERE [百度北纬]=@Coder百度北纬");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@Coder百度北纬", coder百度北纬, DbType.Double, 8)
							.ExecuteList(new TStationAreaEO().GetMapper(), tm);
		}

		/// <summary>
		/// 按自定义条件查询
		/// </summary>
		/// <param name = "where">自定义条件,where子句</param>
		/// <param name = "top">获取行数</param>
		/// <param name = "sort">排序表达式</param>
		/// <param name = "paras">where子句中定义的参数集合</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<TStationAreaEO> Select(string where, int top, string sort, IEnumerable<DbParameter> paras, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [ID], [省市], [地市], [县域], [站名], [站号], [东经], [北纬], [拔高], [百度东经], [百度北纬] FROM [dbo].[T_Station_Area] ");
			if (!string.IsNullOrEmpty(where)) format.AppendFormat(" WHERE {0} ", where);
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddParameters(paras)
							.ExecuteList(new TStationAreaEO().GetMapper(), tm);
		}

		/// <summary>
		/// 分页查询
		/// </summary>
		/// <param name = "where">条件表达式</param>
		/// <param name = "sort">排序表达式</param>
		/// <param name = "paras">传入参数</param>
		/// <param name = "pageSize">页大小</param>
		/// <param name = "pageIndex">页码</param>
		/// <param name = "recordCount">总记录数，由于计算总记录数影响数据库性能，只有小于或等于0的情况下才返回总记录数</param>
		/// <return>分页数据</return>
		public List<TStationAreaEO> SelectPager(string where, string sort, IList<DbParameter> paras, long pageSize, long pageIndex, ref long recordCount)
		{
			var sql = new StringBuilder();
			sql.AppendFormat(@"SELECT [ID], [省市], [地市], [县域], [站名], [站号], [东经], [北纬], [拔高], [百度东经], [百度北纬] FROM [dbo].[T_Station_Area]");
			if (!string.IsNullOrEmpty(where)) sql.AppendFormat(" WHERE {0} ", where);
			if (!string.IsNullOrEmpty(sort)) sql.AppendFormat(" ORDER BY {0} ", sort);
			var pager = this.DataBase.CreatePager(sql.ToString(), pageSize);
			pager.AddParameters(paras);
			if (recordCount <= 0)
			{
				recordCount = pager.GetRecordCount();
			}
			return pager.GetPageData(pageIndex).MapToList(new TStationAreaEO().GetMapper());
		}

		#endregion

		#region Insert方法集合
		/// <summary>
		/// 插入数据，有自增列时，item中自增字段为新增值，否则，返回影响的行数
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "item">要插入的实体对象</param>
		/// <return></return>
		public int Insert(TStationAreaEO item, TransactionManager tm = null)
		{
			const string sql = @"INSERT INTO [dbo].[T_Station_Area] ([省市], [地市], [县域], [站名], [站号], [东经], [北纬], [拔高], [百度东经], [百度北纬]) VALUES (@省市, @地市, @县域, @站名, @站号, @东经, @北纬, @拔高, @百度东经, @百度北纬) ;SELECT SCOPE_IDENTITY();";
			item.ID = long.Parse(AdoBase(sql)
												.AddInParameter("@省市", item.Coder省市, DbType.AnsiString, 50)
												.AddInParameter("@地市", item.Coder地市, DbType.AnsiString, 50)
												.AddInParameter("@县域", item.Coder县域, DbType.AnsiString, 50)
												.AddInParameter("@站名", item.Coder站名, DbType.AnsiString, 50)
												.AddInParameter("@站号", item.Coder站号, DbType.AnsiString, 50)
												.AddInParameter("@东经", item.Coder东经.HasValue ? (object)item.Coder东经.Value : DBNull.Value, DbType.Double, 8)
												.AddInParameter("@北纬", item.Coder北纬.HasValue ? (object)item.Coder北纬.Value : DBNull.Value, DbType.Double, 8)
												.AddInParameter("@拔高", item.Coder拔高.HasValue ? (object)item.Coder拔高.Value : DBNull.Value, DbType.Double, 8)
												.AddInParameter("@百度东经", item.Coder百度东经.HasValue ? (object)item.Coder百度东经.Value : DBNull.Value, DbType.Double, 8)
												.AddInParameter("@百度北纬", item.Coder百度北纬.HasValue ? (object)item.Coder百度北纬.Value : DBNull.Value, DbType.Double, 8)
												.ExecuteScalar(tm).ToString());
			return 1;
		}
		#endregion

		#region Update方法集合
		/// <summary>
		/// 按自定义条件更新数据
		/// </summary>
		/// <param name = "set">更新列</param>
		/// <param name = "where">更新条件</param>
		/// <param name = "paras">参数集合</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public int Update(string set, string where, IEnumerable<DbParameter> paras, TransactionManager tm = null)
		{
			if (string.IsNullOrEmpty(set)) throw new ArgumentNullException("set");
			var sql = string.Format(@"UPDATE [dbo].[T_Station_Area] SET {0} {1}", set, (string.IsNullOrEmpty(where) ? string.Empty : " WHERE " + where));
			return AdoBase(sql)
							.AddParameters(paras)
							.ExecuteNonQuery(tm);
		}
		#endregion

		#region Delete方法集合
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "iD"></param>
		public int DeleteByID(long iD, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[T_Station_Area] WHERE [ID]=@ID";
			return AdoBase(sql)
							.AddInParameter("@ID", iD, DbType.Int64, 8)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "coder省市"></param>
		public int DeleteByCoder省市(string coder省市, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[T_Station_Area] WHERE [省市]=@省市";
			return AdoBase(sql)
							.AddInParameter("@省市", coder省市, DbType.AnsiString, 50)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "coder地市"></param>
		public int DeleteByCoder地市(string coder地市, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[T_Station_Area] WHERE [地市]=@地市";
			return AdoBase(sql)
							.AddInParameter("@地市", coder地市, DbType.AnsiString, 50)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "coder县域"></param>
		public int DeleteByCoder县域(string coder县域, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[T_Station_Area] WHERE [县域]=@县域";
			return AdoBase(sql)
							.AddInParameter("@县域", coder县域, DbType.AnsiString, 50)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "coder站名"></param>
		public int DeleteByCoder站名(string coder站名, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[T_Station_Area] WHERE [站名]=@站名";
			return AdoBase(sql)
							.AddInParameter("@站名", coder站名, DbType.AnsiString, 50)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "coder站号"></param>
		public int DeleteByCoder站号(string coder站号, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[T_Station_Area] WHERE [站号]=@站号";
			return AdoBase(sql)
							.AddInParameter("@站号", coder站号, DbType.AnsiString, 50)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "coder东经"></param>
		public int DeleteByCoder东经(double? coder东经, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[T_Station_Area] WHERE [东经]=@东经";
			return AdoBase(sql)
							.AddInParameter("@东经", coder东经.HasValue ? (object)coder东经.Value : DBNull.Value, DbType.Double, 8)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "coder北纬"></param>
		public int DeleteByCoder北纬(double? coder北纬, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[T_Station_Area] WHERE [北纬]=@北纬";
			return AdoBase(sql)
							.AddInParameter("@北纬", coder北纬.HasValue ? (object)coder北纬.Value : DBNull.Value, DbType.Double, 8)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "coder拔高"></param>
		public int DeleteByCoder拔高(double? coder拔高, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[T_Station_Area] WHERE [拔高]=@拔高";
			return AdoBase(sql)
							.AddInParameter("@拔高", coder拔高.HasValue ? (object)coder拔高.Value : DBNull.Value, DbType.Double, 8)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "coder百度东经"></param>
		public int DeleteByCoder百度东经(double? coder百度东经, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[T_Station_Area] WHERE [百度东经]=@百度东经";
			return AdoBase(sql)
							.AddInParameter("@百度东经", coder百度东经.HasValue ? (object)coder百度东经.Value : DBNull.Value, DbType.Double, 8)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "coder百度北纬"></param>
		public int DeleteByCoder百度北纬(double? coder百度北纬, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[T_Station_Area] WHERE [百度北纬]=@百度北纬";
			return AdoBase(sql)
							.AddInParameter("@百度北纬", coder百度北纬.HasValue ? (object)coder百度北纬.Value : DBNull.Value, DbType.Double, 8)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 删除指定条件的记录
		/// </summary>
		/// <param name = "whereClause">自定义删除条件，where子句。如：id=1 and name='aaa'</param>
		/// <param name = "paras">where子句中定义的参数集合</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public int Delete(string whereClause, IEnumerable<DbParameter> paras, TransactionManager tm = null)
		{
			var sql = string.Format(@"DELETE FROM [dbo].[T_Station_Area] {0}", (string.IsNullOrEmpty(whereClause) ? string.Empty : " WHERE " + whereClause));
			return AdoBase(sql)
							.AddParameters(paras)
							.ExecuteNonQuery(tm);
		}
		#endregion

		#region  自定义方法集合
		#endregion

	}


	#endregion
}
